package com.fenghongzhang.day012;

import androidx.appcompat.app.AppCompatActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;

public class Main3Activity extends AppCompatActivity {

    private  LocalBroadcastManager instance;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);

       instance = LocalBroadcastManager.getInstance(this);

        MyReceiver6 myReceiver6 = new MyReceiver6();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.feng.local");
//        registerReceiver(myReceiver6,intentFilter);
        instance.registerReceiver(myReceiver6,intentFilter);

    }

    public void send1(View view) {
        Intent intent = new Intent();
        intent.setAction("com.feng.local");
//        sendBroadcast(intent);
        instance.sendBroadcast(intent);
    }
}
